<?php



namespace App\Http\Requests\ApiV2;

class WishBgImageRequest extends BaseRequest
{
    public function rules()
    {
        return [
            'file' => 'required|image|max:1024',
            'wish_id' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'wish_id.required' => __('请检查心愿id'),
            'file.required' => __('请上传文件'),
            'file.image' => __('请上传图片文件'),
            'file.max' => __('文件不能超过:size', ['size' => '3M']),
        ];
    }

    public function filldata()
    {
        $prefix = 'wish/' . date("Ymd");
        $result = save_image($this->file('file'), $prefix, 'bg');
        return [
            'wish_id' => (int)$this->input('wish_id'),
            'thumb_small' => $result['urlSmall'],
            'thumb' => $result['urlMedium']

        ];

    }
}
